package com.oc.mba.presist;

import com.j256.ormlite.dao.ForeignCollection;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.field.ForeignCollectionField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = "exam_paper_topic")
public class Topic {

	@DatabaseField(generatedId = true)
	private Long id;
	
	/** 问题ID **/
	@DatabaseField
	private Long topicId;

	@DatabaseField(foreign = true, foreignAutoRefresh = true,columnName="paperId") 
	private Paper paper; // 略去get set

	/** 序号 **/
	@DatabaseField
	private int index;

	/** 问题类型 **/
	@DatabaseField
	private int type;

	/** 问题题干 **/
	@DatabaseField
	private String title;

	/** 图片 **/
	@DatabaseField
	private String image;

	@ForeignCollectionField(eager = true)
	private ForeignCollection<Answer> answers;

	@ForeignCollectionField(eager = true)
	private ForeignCollection<Solution> solutions;
	
	@ForeignCollectionField(eager = true)
	private ForeignCollection<Technique> techniques;
	
	public Topic() {

	}

	public Paper getPaper() {
		return paper;
	}

	public void setPaper(Paper paper) {
		this.paper = paper;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public Long getTopicId() {
		return topicId;
	}

	public void setTopicId(Long topicId) {
		this.topicId = topicId;
	}

	public ForeignCollection<Answer> getAnswers() {
		return answers;
	}

	public void setAnswers(ForeignCollection<Answer> answers) {
		this.answers = answers;
	}

	
	public ForeignCollection<Solution> getSolution() {
		return solutions;
	}

	public void setSolution(ForeignCollection<Solution> solution) {
		this.solutions = solution;
	}

	public ForeignCollection<Technique> getTechnique() {
		return techniques;
	}

	public void setTechnique(ForeignCollection<Technique> technique) {
		this.techniques = technique;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("id=").append(id);
		sb.append("topicId=").append(topicId);
		return sb.toString();
	}
}
